package day04;

import java.util.Scanner;

//课堂练习,循环，生成随机数
public class Demo {
    public static void main(String[] args) {
/*
    int times = 0;
    while (times<5){
            System.out.println("行动是成功的阶梯。");
            times++;
        }
        System.out.println("继续执行...");

    int num = 1;
    while(num<=9){
        System.out.println(num+"*9="+num*9);
        num+=2;
    }

 */


    int n =(int) (Math.random()*1000+1);
    Scanner scanner = new Scanner(System.in);
        int guess;
        do {
            System.out.println("猜：");
            guess = scanner.nextInt();
            if (guess>n){
                System.out.println("大了");
            }else {
                System.out.println("小了");
            }
        }while(guess!=n);
        System.out.println("猜对了。");
/*
    int a = (int) (Math.random()*1000+1);
    Scanner scanner = new Scanner(System.in);
    System.out.println("输入你猜的数：");
        int guess = scanner.nextInt();
     while (guess!=a){
         if (guess>a){
             System.out.println("您猜大了！请再来一次：");
         }else {
             System.out.println("您猜小了！请再来一次：");
         }
         guess=scanner.nextInt();
    }
        System.out.println("恭喜您猜对了！");


 */

    }

}
